<script language="javascript" src="<?php echo JQUERYUI?>jquery.ui.mouse.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI?>jquery.ui.draggable.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI?>jquery.ui.position.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI?>jquery.ui.resizable.min.js"></script>
<script language="javascript" src="<?php echo JQUERYUI?>jquery.ui.dialog.min.js"></script>
<script>
function load_form_setoran(no_spj,tgl){	
	$("#dialog").empty();
	$("#ui-dialog-title-dialog").text("Detail Setoran Kasir");
	$("#dialog").append('<center><img src="<?php echo IMAGES?>spinner.gif"/></center>');
	if(no_spj!=' '){
		$("#dialog").load("<?php echo RESER?>detail_setoran_bank/"+no_spj+"/");
	}else{
		$("#dialog").append('<center><h1>Anda tidak dapat mengisi form setoran karena tidak ada no SPJ</h1></center>');
	}
	$("#dialog").dialog("open");
}

$(document).ready(function() {
	$( "#dialog" ).dialog({
		autoOpen: false,
		width : 700,
		height : 600,
	});
	$( ".date" ).datepicker();
	$( ".date" ).datepicker( "option", "dateFormat", "dd-mm-yy");
	$( "#pilih_tanggal" ).change(function(){
		location.href = "<?php echo RESER ?>list_setoran_bank/"+$( this ).val();
	});    
	
	list_table = $('#list_setoran_bank').dataTable({
		"bFilter" : true,
		"bJQueryUI": true,
        "aLengthMenu": [[10,25,50, 100, -1], [10,25,50,100, "All"]],
		"sPaginationType": "full_numbers",
		"oLanguage": {
            "sLengthMenu": "Menampilkan _MENU_ data",
            "sZeroRecords": "Belum ada data setoran yang tersimpan",
            "sInfoFiltered": "(Hasil filter dari _MAX_ yang didapat)"
        }
    });
	
	$('#asal').change( function () {
		asal = $( '#asal' ).val();
		tujuan = $( '#tujuan' ).val();
		if(asal=='SEMUA'&&tujuan=='SEMUA'){
			
		}else if(asal!='SEMUA'&&tujuan=='SEMUA'){
			list_table.fnFilter( asal,5 );
		}else if(asal=='SEMUA'&&tujuan!='SEMUA'){
			list_table.fnFilter( tujuan,6 );
		}else if(asal!='SEMUA'&&tujuan!='SEMUA'){
			list_table.fnFilter( asal,5 );
			list_table.fnFilter( tujuan,6 );
		}
	});
	
	$('#tujuan').change( function () {
		asal = $( '#asal' ).val();
		tujuan = $( '#tujuan' ).val();
		if(asal=='SEMUA'&&tujuan=='SEMUA'){
			
		}else if(asal!='SEMUA'&&tujuan=='SEMUA'){
			list_table.fnFilter( asal,5 );
		}else if(asal=='SEMUA'&&tujuan!='SEMUA'){
			list_table.fnFilter( tujuan,6 );
		}else if(asal!='SEMUA'&&tujuan!='SEMUA'){
			list_table.fnFilter( asal,5 );
			list_table.fnFilter( tujuan,6 );
		}
	});
	
	$('#list_reservasi_filter').hide();	
});
</script>

<div id="dialog"></div>
<?php
	$data['cur_parent_menu']='setoran';
	$data['cur_selected_menu']='setoran_bank';
	$this->load->view('template/menu_view',$data);
?>
<br/><br/><br/><br/><br/><br/>
<center>	
	Pilih Tanggal : <input type="text" class="date" name="pilih_tangal" id="pilih_tanggal" value="<?php echo $tgl?>"/>
</center>
<br/>
<div class="maia-aux">
<table id="list_setoran_bank" width="100%">
	<thead>
		<tr>
			<th>No</th>
			<th>Tanggal</th>
			<th>Kasir</th>
			<th>No. Resi</th>
			<th>Total Setoran</th>
			<th>Action</th>
		</tr>
	</thead>
	<tbody>
		<?php for($i=0;$i<count($list);$i++){?>
		<tr>
			<td align="center"><?php echo ($i+1)?></td>
			<td align="center"><?php echo $list[$i]['tanggal']?></td>
			<td align="center"><?php echo $join[$i]['nama']?></td>
			<td align="center"><?php echo $list[$i]['noresi']?></td>
			<td align="center"><?php echo $list[$i]['total']?></td>
			<td align="center">
			<?php 
				echo '<span class="clicked" onclick="load_form_setoran(\''.$list[$i]['id'].'\',\''.$list[$i]['tanggal'].'\')">Detail </span>&nbsp;&nbsp;';
				echo '<a target="_blank" href="'.RESER.'cetak_setoran?tanggal='.$list[$i]['tanggal'].'&&nama='.$join[$i]['nama'].'&&noresi='.$list[$i]['total'].'">Cetak</a>';
			?>
			</td>
		</tr>
		<?php } ?>
                
	</tbody>
</table>
</div>